<!DOCTYPE html>
<html ng-app="app">
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body ng-controller="MainCtrl as ctrl">
		<form ng-submit="ctrl.submit1()">
			<input type="text" ng-model="ctrl.username"/>
			<input type="password" ng-model="ctrl.password"/>
			<input type="submit" value="submit"/>
		</form>
		<form ng-submit="ctrl.submit2()">
			<input type="text" ng-model="ctrl.user.username"/>
			<input type="password" ng-model="ctrl.user.password"/>
			<input type="submit" />
		</form>
	</body>
	<script src="js/angular.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		angular.module('app', [])
		.controller('MainCtrl', [function(){
			var self = this;
			self.submit1 = function(){
				var user = {username:self.username, password:self.password};
				console.log('First form submit with ', user);
			};
			self.submit2 = function() {
				console.log('Second form submit with ', self.user);
			}
		}]);
	</script>
</html>
